Skip to content

Commit

Permalink
install the azle extension with a new azle command
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmjs committed Apr 23, 2024
1 parent a46bc4d commit 7a1b959
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ jobs:
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0}
run: npm run lint
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
working-directory: ${{ matrix.example_directories }}
run: dfx start --clean --background --host 127.0.0.1:8000
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
Expand All @@ -305,6 +302,12 @@ jobs:
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
run: npm link azle
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
working-directory: ${{ matrix.example_directories }}
run: npx azle install-dfx-extension
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
working-directory: ${{ matrix.example_directories }}
run: dfx start --clean --background --host 127.0.0.1:8000
# This is to put wasmedge-quickjs in the correct location for the --native-compilation tests
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0}
Expand Down
18 changes: 18 additions & 0 deletions src/compiler/handle_cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IOType } from 'child_process';
import { rmSync } from 'fs';
import { join } from 'path';

import { version as azleVersion } from '../../package.json';
import { uploadFiles } from './file_uploader';
Expand Down Expand Up @@ -46,6 +47,12 @@ export function handleCli(
return true;
}

if (commandName === 'install-dfx-extension') {
installDfxExtension(stdioType);

return true;
}

return false;
}

Expand Down Expand Up @@ -109,3 +116,14 @@ async function handleUploadAssets() {
function handleVersionCommand() {
console.info(azleVersion);
}

// TODO this is just temporary
// TODO until we either make azle an official extension in the DFINITY dfx extensions repo
// TODO or we have a better way for the developer to install the extension locally
function installDfxExtension(stdioType: IOType) {
const dfxExtensionDirectoryPath = join(__dirname, '../../dfx_extension');
execSyncPretty(
`cd ${dfxExtensionDirectoryPath} && ./install.sh`,
stdioType
);
}
16 changes: 0 additions & 16 deletions src/compiler/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { IOType } from 'child_process';
import { mkdirSync, writeFileSync } from 'fs';
import { join } from 'path';

import { compileRustCodeWithCandidAndCompilerInfo } from './compile_rust_code_with_candid_and_compiler_info';
import { setupFileWatcher } from './file_watcher/setup_file_watcher';
Expand All @@ -12,7 +10,6 @@ import { prepareDockerImage } from './prepare_docker_image';
import { prepareRustStagingArea } from './prepare_rust_staging_area';
import { logSuccess, time, unwrap } from './utils';
import { green } from './utils/colors';
import { execSyncPretty } from './utils/exec_sync_pretty';
import { GLOBAL_AZLE_CONFIG_DIR } from './utils/global_paths';
import { CompilerInfo } from './utils/types';

Expand Down Expand Up @@ -44,8 +41,6 @@ async function azle() {
return;
}

installDfxExtension(stdioType);

const {
canisterName,
canisterPath,
Expand Down Expand Up @@ -139,14 +134,3 @@ function createAzleDirectories() {
mkdirSync(GLOBAL_AZLE_CONFIG_DIR, { recursive: true });
mkdirSync('.azle', { recursive: true });
}

// TODO this is just temporary
// TODO until we either make azle an official extension in the DFINITY dfx extensions repo
// TODO or we have a better way for the developer to install the extension locally
function installDfxExtension(stdioType: IOType) {
const dfxExtensionDirectoryPath = join(__dirname, '../../dfx_extension');
execSyncPretty(
`cd ${dfxExtensionDirectoryPath} && ./install.sh`,
stdioType
);
}

0 comments on commit 7a1b959

Please sign in to comment.