8000 unoconfig: {Packages -> References}.Default (beta-3.0) by mortend · Pull Request #464 · fuse-open/uno · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

unoconfig: {Packages -> References}.Default (beta-3.0) #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,37 @@ C:\> git clone https://github.com/fuse-open/fuselibs.git
```

```javascript
if (DEV) {
Packages.SourcePaths += `C:\fuselibs\Source`
}
SearchPaths.Sources += `C:\fuselibs\Source`
```

(Replace `C:\fuselibs\Source` with your own location.)

Run `uno doctor` to build your standard library.

### Additional libraries

Use the following `.unoconfig` properties to add additional Uno libraries (or projects) to your search paths.

```javascript
SearchPaths += find/my/packages/here
SearchPaths.Sources += build/these/projects
```

### Conditional inclusion

```javascript
if (DEV) {
SearchPaths.Sources += `C:\fuselibs\Source`
}
```

The `if (DEV)` test makes sure we only use those packages when running `uno` built from source.
If omitted, the packages are also made available to any installed versions of Fuse Studio and Uno,
which might have unintended side-effects.

Run `uno doctor` to build your standard library.
## Dependencies

## Android
### Android

To support building Android apps, we need to know where your [Android SDKs](https://developer.android.com/studio/index.html)
are installed. Running `npm install -g android-build-tools@1.x` will set this up automatically, or you can
Expand All @@ -48,7 +65,7 @@ Android.NDK: ~/Library/Android/sdk/ndk-bundle
Android.SDK: ~/Library/Android/sdk
```

## iOS
### iOS

To support building iOS apps, we need macOS and Xcode.

Expand All @@ -60,20 +77,9 @@ This is usually automatically detected, but configuring a signing identity can b
iOS.DeveloperTeam: ABCD012345
```

## Native
### Native

To support building native apps, we need [CMake](https://cmake.org/) and C++ compilers.

- **macOS:** Xcode with command line tools
- **Windows:** Visual Studio 2019

## Node.js

We need [Node.js](https://nodejs.org/en/download/) to support transpiling FuseJS files to ES5.

## Package manager

```javascript
Packages.SearchPaths += find/my/packages/here
Packages.SourcePaths += build/these/projects
```
6 changes: 4 additions & 2 deletions scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source scripts/common.sh

# Clean stdlib
IFS=$'\n'
for dir in `uno config Packages.SourcePaths`; do
for dir in `uno config SearchPaths.Sources`; do
if [ -d "$dir" ]; then
rm -rf "$dir/build"
uno clean --recursive "$dir"
Expand All @@ -22,4 +22,6 @@ dotnet clean --configuration Debug uno.sln 1> /dev/null
dotnet clean --configuration Release uno.sln 1> /dev/null

# Clean other artifacts
rm -rf bin packages
rm -rf bin \
FuseOpen.UnoCore.*.nupkg \
fuse-open-uno-*.tgz
2 changes: 1 addition & 1 deletion src/test/compiler-test/CompilerTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void Run(ITestResultLogger logger)
private void RunTestSuite(ITestResultLogger logger, string directoryName)
{
var project = new Project(Path.Combine(directoryName, Path.GetFileName(directoryName) + ".unoproj"));
project.MutablePackageReferences.Add(new LibraryReference(project.Source, "Uno.Testing"));
project.MutableLibraryReferences.Add(new LibraryReference(project.Source, "Uno.Testing"));
project.MutableProjectReferences.Add(new ProjectReference(project.Source, "../_Outracks.UnoTest.InternalHelpers/_Outracks.UnoTest.InternalHelpers.unoproj"));

logger.ProjectStarting(project.Name, BuildTargets.Default.Identifier);
Expand Down
4 changes: 2 additions & 2 deletions src/tool/cli/Building/Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public override void Execute(IEnumerable<string> args)
{
project.MutableIncludeItems.Add("*");

foreach (var e in project.Config.GetStringArray("Packages.Default") ?? new string[0])
project.MutablePackageReferences.Add(e);
foreach (var e in project.Config.GetStringArray("References.Default", "Packages.Default") ?? new string[0])
project.MutableLibraryReferences.Add(e);
}

if (className != null)
Expand Down
2 changes: 1 addition & 1 deletion src/tool/cli/Building/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public override void Execute(IEnumerable<string> args)
if (project.InternalsVisibleTo.Count > 0)
project.MutableInternalsVisibleTo.Sort();
if (project.PackageReferences.Count > 0)
project.MutablePackageReferences.Sort();
project.MutableLibraryReferences.Sort();
if (project.ProjectReferences.Count > 0)
project.MutableProjectReferences.Sort();

Expand Down
7 changes: 7 additions & 0 deletions src/tool/config/UnoConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ public string[] GetStringArray(string key)
return GetStrings(key).Select(x => x.Value).ToArray();
}

public string[] GetStringArray(string key1, string key2)
{
return GetStrings(key1).Select(x => x.Value)
.Concat(GetStrings(key2).Select(x => x.Value))
.ToArray();
}

public string GetString(string key)
{
var strings = GetStrings(key);
Expand Down
4 changes: 2 additions & 2 deletions src/tool/engine/Libraries/LibraryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public HashSet<string> GetSourceDirectories(UnoConfig config = null)
return sourceDirectories;
}

var configSourcePaths = (config ?? UnoConfig.Current).GetFullPathArray("Packages.SourcePaths", "PackageSourcePaths");
var configSourcePaths = (config ?? UnoConfig.Current).GetFullPathArray("SearchPaths.Sources", F438 "Packages.SourcePaths");

if (configSourcePaths.Length == 0)
{
Log.VeryVerbose("'Packages.SourcePaths' was not found in .unoconfig");
Log.VeryVerbose("'SearchPaths.Sources' was not found in .unoconfig");
return sourceDirectories;
}

Expand Down
6 changes: 3 additions & 3 deletions src/tool/engine/Libraries/LibraryDoctor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ public bool Repair(ManifestFile file, bool force = false)
return false;
}

public IEnumerable<DirectoryInfo> EnumerateDirectories(List<string> optionalPackages = null)
public IEnumerable<DirectoryInfo> EnumerateDirectories(List<string> optionalLibraries = null)
{
var cache = new BundleCache();

if (optionalPackages == null || optionalPackages.Count == 0)
if (optionalLibraries == null || optionalLibraries.Count == 0)
foreach (var dir in cache.EnumerateVersions("*"))
yield return dir;
else
{
foreach (var p in optionalPackages)
foreach (var p in optionalLibraries)
{
var result = cache.EnumerateVersions(p).ToArray();
if (result.Length == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/tool/project/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public string FullPath
public IEnumerable<FileItem> FuseJSFiles => GetFlattenedItems().Where(x => x.Type == IncludeItemType.FuseJS).Select(x => new FileItem(x.Value, x.Condition));

public Dictionary<string, SourceValue> MutableProperties => _doc.Properties;
public List<LibraryReference> MutablePackageReferences => _doc.OptionalLibraryReferences ?? (_doc.OptionalLibraryReferences = new List<LibraryReference>());
public List<LibraryReference> MutableLibraryReferences => _doc.OptionalLibraryReferences ?? (_doc.OptionalLibraryReferences = new List<LibraryReference>());
public List<SourceValue> MutableInternalsVisibleTo => _doc.OptionalInternalsVisibleTo ?? (_doc.OptionalInternalsVisibleTo = new List<SourceValue>());

public List<ProjectReference> MutableProjectReferences
Expand Down
0