Skip to content

Commit

Permalink
refactor(devtools): remove git sha stamping from devtools build (#55694)
Browse files Browse the repository at this point in the history
This stamping is interfering with publishing to the Firefox addons store by brining in the entirety of the `.git` directory as part of the source code necessary for a reproducible build, which Firefox requires as part of it's approval process.

In it's place, we are now using the extension version pulled from the manifest.

PR Close #55694
  • Loading branch information
AleksanderBodurri authored and AndrewKushnir committed May 6, 2024
1 parent 76f2c4f commit 77ae5a3
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 30 deletions.
7 changes: 0 additions & 7 deletions devtools/projects/demo-standalone/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ pkg_web(
":bundle",
"@npm//:node_modules/tslib/tslib.js",
],
# Currently, ibazel doesn't allow passing in flags to bazel run.
# This means we are not able to use --config snapshot-build
# to access the current commit SHA.
# Since we still want to be able to use ibazel to speed up
# local development, we supply an empty string for the SHA substitution.
# This does not effect production builds.
substitutions = {"BUILD_SCM_COMMIT_SHA": ""},
)

http_server(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@

export const environment = {
production: false,
LATEST_SHA: 'BUILD_SCM_COMMIT_SHA', // Stamped at build time by bazel
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/

interface Env {
LATEST_SHA: string;
}

export interface Environment {
production: boolean;
LATEST_SHA: string;
}

export const TOP_LEVEL_FRAME_ID = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
</span>
}

@if (latestSHA) {
| DevTools SHA: {{ latestSHA }}
}
| DevTools: {{ extensionVersion }}
</section>
}
</nav>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export class DevToolsTabsComponent implements OnInit, AfterViewInit {
return parseInt(version.toString().split('.')[0], 10);
});

extensionVersion = 'Development Build';

constructor(
public tabUpdate: TabUpdate,
public themeService: ThemeService,
Expand All @@ -111,6 +113,10 @@ export class DevToolsTabsComponent implements OnInit, AfterViewInit {

ngOnInit(): void {
this.navbar.stretchTabs = false;

if (chrome !== undefined && chrome.runtime !== undefined) {
this.extensionVersion = chrome.runtime.getManifest().version;
}
}

get tabs(): Tabs[] {
Expand All @@ -122,10 +128,6 @@ export class DevToolsTabsComponent implements OnInit, AfterViewInit {
this.navbar.disablePagination = true;
}

get latestSHA(): string {
return this.applicationEnvironment.environment.LATEST_SHA.slice(0, 8);
}

changeTab(tab: Tabs): void {
this.activeTab = tab;
this.tabUpdate.notify();
Expand Down
1 change: 0 additions & 1 deletion devtools/projects/shell-browser/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,4 @@ pkg_web(
additional_root_paths = [
"projects/ng-devtools/src/lib",
],
substitutions = {"BUILD_SCM_COMMIT_SHA": "{BUILD_SCM_COMMIT_SHA}"},
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@

export const environment = {
production: true,
LATEST_SHA: 'BUILD_SCM_COMMIT_SHA', // Stamped at build time by bazel
};
7 changes: 0 additions & 7 deletions devtools/src/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,6 @@ pkg_web(
":bundle",
"@npm//:node_modules/tslib/tslib.js",
],
# Currently, ibazel doesn't allow passing in flags to bazel run.
# This means we are not able to use --config snapshot-build
# to access the current commit SHA.
# Since we still want to be able to use ibazel to speed up
# local development, we supply an empty string for the SHA substitution.
# This does not effect production builds.
substitutions = {"BUILD_SCM_COMMIT_SHA": ""},
)

http_server(
Expand Down
1 change: 0 additions & 1 deletion devtools/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@

export const environment = {
production: false,
LATEST_SHA: 'BUILD_SCM_COMMIT_SHA', // Stamped at build time by bazel
};

0 comments on commit 77ae5a3

Please sign in to comment.