1. 17 9月, 2021 1 次提交
  2. 02 7月, 2021 1 次提交
  3. 16 4月, 2021 1 次提交
  4. 08 4月, 2021 1 次提交
  5. 05 2月, 2021 1 次提交
  6. 30 1月, 2021 1 次提交
    • A
      [wasm] Add support for building out-of-tree projects, which use a local runtime build (#47555) · 6299c9c5
      Ankit Jain 提交于
      * [wasm] Add $( WasmBuildAppAfterThisTarget) to control which target
      
      .. triggers WasmAppBuild. Defaults to `Publish`.
      
      * [wasm] emcc, mono-aot-cross doesn't like relative output paths
      
      eg. `-o foo/bar.js`
      
      .. so convert that to absolute paths.
      
      * [wasm] Check for WasmMainJSPath close to it's use
      
      * [wasm] Add new $(WasmGenerateAppBundle) to allow skipping app bundle
      
      .. generation. This is useful when you want to do all the other steps
      for wasm, but handle the packaging/bundle generation yourself. Eg.
      Blazor
      
      * [wasm] Ensure that generated dotnet.{js,wasm} get copied to the app dir
      
      This is usually done as part of the bundle generation (NativeAssets).
      But in cases when that step is being skipped, we still want to copy over
      generated dotnet.{js,wasm} (eg. in case of AOT) to the app dir. This is
      the case that blazor uses.
      
      * [wasm] Allow skipping mono-cil-strip step
      
      In some cases, eg. blazor (till we fix it), `mono-cil-strip` can break
      the app, because of bugs, or linker issues etc.
      
      Also, do this only in the AOT case.
      
      * [wasm] Add support for building wasm projects outside the tree
      
      .. using local runtime builds.
      
      * [wasm] fix up the support for local build dir
      
      * [wasm] add comments for new properties
      
      * [wasm] LocalBuild.*: add more comments, validation
      
      * [wasm] sample: Use BeforeTargets for Prepare target, as a psuedo test for that
      6299c9c5
  7. 26 1月, 2021 1 次提交
    • A
      [wasm] WasmApp.targets: Separate `obj`, and `bin` parts of the build process (#47253) · b6fb6115
      Ankit Jain 提交于
      We want to use a separate directory for intermediate build outputs, that aren't needed
      in the app bundle, and reduce unclear internal dependencies during a build.
      
      # TL;DR
      
      ## Changes:
      1. `$(WasmBuildDir)` removed
      2. Reasonable defaults set for most properties
      3. To generate a wasm app for a project, the minimum you need to set:
          a. `$(WasmMainJS)`,
          b. and `@(WasmAssembliesToBundle)`
      
      # Details:
      
      Though it is a bit tricky, because the current targets assume:
      
      - that they are being run after `Publish`
      - that the publish directory has:
        - some required files copied over from the runtime pack (eg. `libmono*`),
        - and includes the assemblies
      - that the targets emit all the intermediate output files like `driver.o`, or the bitcode files, into the same
         directory
      
      - And there are assumptions about where to pick which files from (eg. whether to take `dotnet.wasm`
        from the runtime pack, or from the publish dir), based on unclear rules.
      
      ## What does this PR change?
      
      - All the assets meant to be from the runtime pack (like `libmono*`, `icudt.dat`) are always taken
        only from the runtime pack
        - and this logic is moved out of the tasks, to the targets
      - `$(WasmBuildDir)` is removed completely. Instead, we use an intermediate path based on `$(IntermediateOutputPath)`
        - and emit all the intermediate bits there, like the bitcode files
      - Add reasonable defaults for various properties, like `$(WasmAppDir)`
      
      Effectively:
      
      1. To generate a wasm app for a project, the minimum you need to set:
          a. `$(WasmMainJS)`,
          b. and `@(WasmAssembliesToBundle)`
      
      2. The targets don't depend on publish dir at all
          (in a future PR, we could remove triggering based on `Publish` target also)
      * [wasm] WasmAppBuilder - move the list of native assets, and logic out
      
      .. to the targets.
      
      - New property: `NativeAssets`, populated by `@(WasmNativeAsset)`
      - Remove property `MicrosoftNetCoreAppRuntimePackRidDir`
      - Also, add the `icudt.dat` file from the targets
      
      * [wasm] Simplify handling of dotnet.{js,wasm}
      
      WasmAppBuilder has (non-obvious) logic to:
      
      1. if AOT'ing, then use the *generated* dotnet.{js,wasm};
      2. else use the one from the runtime pack
      
      This depends on Publish having copied those files from the runtime pack
      to the publish directory, and then comparing paths in the builder to
      decide which one to use.
      
      Instead, make this the intention obvious, and clear.
      
      ----
      Commits:
      * [wasm] Always get the native libs from the runtime pack (eg.libmono*)
      
      We were getting these from the publish directory, instead we can get
      them directly from the runtime pack.
      
      This includes icudt.dt, and dotnet.timezones.blat .
      
      * [wasm] MonoAOTCompiler: add `OutputDir` property
      
      .. where we can emit the generated native files. Since these files are
      meant only for generating the final `dotnet.wasm`, we don't want them to
      put them in the bin directory.
      
      * [wasm] Use existing list of assemblies - @(_WasmAssemblies)
      
      .. instead of trying to find them in the build dir. This build directory
      will become a directory for intermediate build output in upcoming
      commits.
      
      * [wasm] Replace $(WasmMainAssemblyPath) with $(WasmMainAssemblyFileName)
      
      - Instead of having a special $(WasmMainAssemblyPath), and then adding
        it to the wasm assemblies ourselves
        - let the user project add all the relevant assemblies to
          `@(WasmAssembliesToBundle)`, which is usually as simple as
          `$(OutDir)\*.dll`.
      
      - This helps to simplify lot of things.
      - And we just need the main assembly filename for generating the
        run-v8.sh script.
      
      * [wasm] Rename WasmBuildDir -> _WasmIntermediateOutputPath
      
      Based on the changes in previous commits, we can now remove
      `$(WasmBuildDir)`, and replace that with an internal
      `$(_WasmIntermediateOutputPath)`. This path will have all the build
      artifacts generated that aren't required in the app bundle.
      
      Earlier, we were using the publish directory for that, which resulted in
      it being littered with unncessary files, and files getting copied to the
      app bundle from unclear sources, and for non-obvious reasons.
      
      * [wasm] add default value for $(WasmAppDir)
      
      * [wasm] WasmApp.targets - misc cleanup
      
      * [wasm] WasmAppBuilder: validate Assemblies property
      
      * [wasm] WasmTestRunner - rename TestAssembly->TestAssemblyFileName, to correctly reflect the value
      
      * [wasm] Fix make clean, for samples
      
      * [wasm] WasmApp.targets: Add new $(MonoAotCrossCompilerPath)
      
      * [wasm] update comments/docs
      
      * Address review feedback from @mdh1418
      b6fb6115
  8. 13 1月, 2021 1 次提交
    • A
      [wasm] Simplify, and refactor `WasmApp.targets`, and wasm projects (#46772) · 689bcb2e
      Ankit Jain 提交于
      Refactor `WasmApp.targets` to:
      
      1. Move duplicated properties, targets from the various wasm projects to a common location
      2. Split `WasmApp.targets` into:
           a. `WasmApp.InTree.props`, and `WasmApp.props`
           b. `WasmApp.InTree.targets`, and `WasmApp.Targets`
      
      - The props/targets split makes this similar to a SDK
      - `WasmApp.{props, targets}` - have the core bits to build a wasm app, but don't have anything specific to the `dotnet/runtime` tree
      - `WasmApp.InTree.{props, targets}` - have bits to facilitate local builds in `dotnet/runtime`, eg. to use a local build of the runtime pack
      
      This simplifies project files a lot. And sets things up for being able to have a wasm SDK, and be able to use them to build wasm apps outside the tree.
      
      Note: In case of the *InTree* files, they depend on runtime specific properties being set, like `$(ArtifactsBinDir)` which are set in inherited `Directory.Build*` files, which tend to override properties even if they are already set. Due to this, in some cases we have to import `*InTree*` files after the inherited ones, and set some properties before, and some after importing `Directory.Build.*`.
      
      * [wasm] WasmAppBuilder: add new input for extra files to deploy
      
      .. to the bundle. This eliminates the need to hack it in with
      aftertargets.
      
      * [wasm] samples: Extract the common bits to Directory.Build.*
      
      - Also, introduce WasmApp.props, to have some of the property defaults
        that aren't specific to the samples
      
      * [wasm] samples: no need to add cs files manually
      
      * [wasm] Extract common bits from wasm FunctionalTests to Directory.Build*
      
      * [wasm] Add WasmApp.InTree.{props,targets}
      
      The *InTree* files have the properties/targets required to build within
      the tree. The main `WasmApp.{props,targets}` should be on the way to
      becoming useful outside the tree.
      
      * [wasm] Update debugger-tests to use the InTree targets
      
      * [wasm] Add  to debugger tests, consistent with other make targets
      
      * [wasm] use TrickRuntimePackLocation target only if applicable
      
      * [wasm] add EMSDK_PATH default value for wasm projects
      
      * [wasm] Move RebuildWasmAppBuilder to InTree.targets
      
      * [wasm] Simplify functionalTests project files
      
      * [wasm] Fix tests in src/tests run with WasmTestRunner
      
      * little cleanup
      
      * Address review feedback from @mdh1418
      
      * add comment
      
      * [wasm] update build/README.md
      
      * Add comment for InTree* files
      
      * [wasm] sample - move some non-debug properties to D.B.props
      
      * [wasm] Move CopySampleAppToHelix* to InTree.targets
      689bcb2e